package com.z.security.entity;

import com.z.entity.security.Admin;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.List;

/**
 * 扩展之前的AdminVO(只有账号和密码)
 * */


public class SecurityAdmin extends User {

   private Admin originalAdmin;

   /**
    * @Param authorities 用户对应的权限和角色
    * */
    public SecurityAdmin(Admin originalAdmin , List<GrantedAuthority> authorities ) {

        super(originalAdmin.getLoginAcct(), originalAdmin.getUserPswd(), authorities);

        this.originalAdmin = originalAdmin;
    }

    public Admin getOriginalAdmin() {
        return originalAdmin;
    }
}
